package com.hsc.www.exchangeType.direct2;


import com.hsc.www.User;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.concurrent.TimeUnit;

@SpringBootTest(classes = App.class)
@RunWith(SpringJUnit4ClassRunner.class)
public class direct2 {

    @Autowired
    private UserSender userSender;

    @Test
    public void testRabbit() throws Exception {

        userSender.send(Config.DOG1_ROUTING_KEY, new User("dog1"));
        userSender.send(Config.DOG2_ROUTING_KEY,  new User("dog2"));
        userSender.send(Config.DOG3_ROUTING_KEY,  new User("dog3"));
        TimeUnit.SECONDS.sleep(10);//等待接收
    }
}